﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Os.WebUI.ViewModels.ClienteReportViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	.: Relatório de Clientes :.
</asp:Content>

<asp:Content ID="HeadContent" ContentPlaceHolderID="headContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $('#Cnpj').mask('99.999.999/9999-99');
        })
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Relatório de Clientes</h2>
    
    <% using (Html.BeginForm()){ %>
        <div class="editor-label">
            <%= Html.LabelFor(model => model.Nome)%>
        </div>
        <div class="editor-field">
            <%= Html.TextBoxFor(model => model.Nome)%>
            <%= Html.ValidationMessageFor(model => model.Nome)%>
        </div>
        <div class="editor-label">
            <%= Html.LabelFor(model => model.Cnpj)%>
        </div>
        <div class="editor-field">
            <%= Html.TextBoxFor(model => model.Cnpj)%>
            <%= Html.ValidationMessageFor(model => model.Cnpj)%>
        </div>
        <input type="submit" value="Gerar Relatório" />
    <% } %>
    
    <table>
        <tr>
            <th>
                Nome
            </th>
            <th>
                Endereço
            </th>
            <th>
                Bairro
            </th>
            <th>
                Cnpj
            </th>
            <th>
                Horas Contratadas
            </th>
             <th>
                Cliente Desde
            </th>
            <th>
                Vigência do Contrato
            </th>
        </tr>

        <% foreach (var item in Model.Clientes) { %>
    
        <tr>
            <td>
                <%= Html.Encode(item.Nome) %>
            </td>
            <td>
                <%= Html.Encode(item.Endereco) %>
            </td>
            <td>
                <%= Html.Encode(item.Bairro) %>
            </td>
            <td>
                <%= Html.Encode(item.Cnpj) %>
            </td>
            <td>
                <%= Html.Encode(item.HorasContratadas) %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:dd/MM/yyy}", item.Desde))%>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:dd/MM/yyy}", item.VigenciaContrato)) %>
            </td>
        </tr>
    
        <% } %>
    </table>
    <div>
        <%= Html.ActionLink("Voltar para Relatórios", "Index") %>
    </div>
</asp:Content>
